﻿// TitleBarButton.qml
import QtQuick 2.15
import QtQuick.Controls 2.15

Rectangle {
    id: button
    width: 40
    height: parent.height
    color: "transparent"

    property string iconSource: ""
    property color hoverColor: "#505050"

    signal clicked

    Image {
        anchors.centerIn: parent
        width: 12
        height: 12
        source: iconSource
        fillMode: Image.PreserveAspectFit
    }

    MouseArea {
        anchors.fill: parent
        hoverEnabled: true
        onClicked: button.clicked()
        onEntered: button.color = hoverColor
        onExited: button.color = "transparent"
    }
}
